<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<script type="text/javascript" src="{:ADMIN}lib/jquery/1.9.1/jquery.js"></script>
	<script src="{:DEMO}wxpay/js/qrcode.js"></script>
</head>
<body>
	<div align="center" id="qrcode" style="padding-top:160px;">
	</div>
	<div align="center">
		<p>订单号：{$out_trade_no}</p>
	</div>
</body>
<script>
	//$(function(){
		if("{$code_url}"!=null){
			var url = "{$code_url}";
			//参数1表示图像大小，取值范围1-10；参数2表示质量，取值范围'L','M','Q','H'
			var qr = qrcode(10, 'H');
			qr.addData(url);
			qr.make();
			var wording=document.createElement('p');
			wording.innerHTML = "微信支付";
			var code=document.createElement('DIV');
			code.innerHTML = qr.createImgTag();
			var element=document.getElementById("qrcode");
			element.appendChild(wording);
			element.appendChild(code);
		}
			
		function Check(){
			var out_trade_no = "{$out_trade_no}";
			$.post("{:url('orderQuery')}",{out_trade_no:out_trade_no},function(res){
				console.log(res)
				if (res.code==200) {
					location.href="{:url('index/cost')}";
				}
			})
		}
		window.setInterval("Check()",1000);
	//})
</script>
</html>